﻿#!/usr/bin/env python
# -*- coding:utf-8 -*-

'thread usage introduction'

__author__='zhaoxp'

import thread,time

def print_time(threadName,delay):
	count=0
	while count<5:
		count=count+1
		time.sleep(delay)
		print '%s: %s' % (threadName,time.ctime(time.time()))

if __name__=='__main__':
	try:
		thread.start_new_thread(print_time,('Thread-1',2))
		thread.start_new_thread(print_time,('Thread-2',4))
	except:
		print 'Error: unable to start thread'
	
	while True:
		pass
